﻿using BZ.AcqDevice.MindVision;
using BZ.Logger;
using NDK.AcqDevice.Keyence;
using NDK.Communacation;
using NDK.Frm;
using NDK.Laser.SSZN;
using NDK.Module.BLL;
using NDK.Module.DAL;
using NDK.Module.Model.ACMTMUR;
//using BoTech.Services;
using NDK.Module.Model.Quebec;
using NDK.Motion.BLL;
using NDK.Motion.MachineResources;
using NDK.Utils;
using System;
//using Lmi3d.GoSdk.Messages;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Forms;
using static NDK.Frm.Frm_Main;
using static NDK.Module.BLL.Configuration;

namespace NDK.Module.Model
{

    #region 窗体动画效果相关常量
    public enum WindowsEffect
    {
        AW_SLIDE = 0x40000,//使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时，这个标志就被忽略。    
        AW_ACTIVATE = 0x20000,//激活窗口。在使用了AW_HIDE标志后不要使用这个标志。    
        AW_BLEND = 0x80000,//使用淡出效果。只有当hWnd为顶层窗口的时候才可以使用此标志。    
        AW_HIDE = 0x10000,//隐藏窗口，缺省则显示窗口。(关闭窗口用)    
        AW_CENTER = 0x0010,//若使用了AW_HIDE标志，则使窗口向内重叠；若未使用AW_HIDE标志，则使窗口向外扩展。    
        AW_HOR_POSITIVE = 0x0001,//自左向右显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时，该标志将被忽略。    
        AW_VER_POSITIVE = 0x0004,//自顶向下显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时，该标志将被忽略。    
        AW_HOR_NEGATIVE = 0x0002,//自右向左显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时，该标志将被忽略。    
        AW_VER_NEGATIVE = 0x0008//自下向上显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时，该标志将被忽略。    
    }
    #endregion

    #region 登陆模式
    public enum LoginMode
    {
        PRODUCTION_MODE = 0,
        ENGINEERING_MODE = 1,
        CPKGRR_MODE = 2
    }
    public enum UserAuthority
    {
        删除用户 = 0,
        添加用户 = 1,
        设置页查看 = 2,
        查看视觉页,
        编辑点位,
        编辑回零,
        添加项目,
        删除项目,
        编辑参数页
    }
    #endregion

    #region Excel输出格式
    public enum SaveDataFormat
    {
        XLS = 0,
        CSV = 1,
        XLSX = 2
    }
    #endregion


    public static class Common
    {
        public static Dictionary<string, string> languageDic = new Dictionary<string, string>();

        public static int PasswordLevel = 0;
        //是否显示软键盘
        public static bool isShowKeyBoard = false;
        //版本信息
        public static string currentVersion = "V1.4.3.220406";
        //保留报警信息的天数
        public static int SaveDaysOfAlarmInfo = 100;
        public static string DatabasePath = Environment.CurrentDirectory + @"\\Config";
        public static string DatabaseName = "test1";

        //------------------------------------------------------------

        //System
        public static Configuration.Language currentLanguage = Language.Chinese;
        public static bool isSelfLockStartButtonPressed = false;//启动和暂停按钮是一个，自锁式
        public static bool isStartAndStop = false;
        public static bool isAxisPosInit = false;

        //是否上传NA
        public static bool isUploadNA = false;
        public static bool isTestStop = false;

        //指纹锁
        public static string fingerPrintAuthority = "";
        public static string fingerPrintUserName = "";
        public static Dlg_AddUeserUI AddUeserUI = new Dlg_AddUeserUI();
        public static string Authority = ""; //登陆用户的权限
        public static bool b_FPLoginClick = false;
        public static bool b_ModifyROIButtonClick = false;
        public static bool b_SaveROIButtonClick = false;
        //public static BioneFPAPILib.FPAPICtrlClass fp; //初始化指纹锁
        public static bool isFileSetPassCode = false;//是否文件夹已经加密，默认是加密状态
        public static FignerPrintForm FPForm = new FignerPrintForm();
        public static int Id = 0;
        public static bool LogIn_TimeOut = false; //登录超时
        public volatile static UserOptionCheckBFMessage msg = null;
        public struct FPUserInfo
        {
            public static string UserName;   //用户名
        }

        //Machine
        public volatile static bool isShiedWarning = false;
        public volatile static bool isCardInitialed = false;
        public volatile static bool isVisionModularInitialed = false;
        public volatile static bool isFingerPrintInitialed = false;
        public volatile static bool isLightControlInitialed = false;
        public volatile static bool isLeftLaserInitialed = false;
        public volatile static bool isConnectMesInitialed = false;
        public volatile static bool isConnectAppleInitialed = false;


        public static List<RseeLightController> lightList = new List<RseeLightController>();
        public static RseeLightController light1 = new RseeLightController();
        public static RseeLightController light2 = new RseeLightController();
        public static RseeLightController light3 = new RseeLightController();
        public static RseeLightController light4 = new RseeLightController();




        //data
        public volatile static string dataSavePath = @"D:\Data\output";
        public volatile static string picSavePath = @"D:\Data\image";
        public volatile static string PDCAPicSavePath = @"\\192.168.10.1\d\TempData\";
        public volatile static string pointCheckEncrypterPath = @"D:\Data\output\temp\点检";

        public static string Line = "";
        public volatile static ConcurrentQueue<MeasureProduct> waitingForWriteToDatabaseDataQueue = new ConcurrentQueue<MeasureProduct>();
        public volatile static ConcurrentQueue<MeasureProduct> waitingForUploadAppleDataQueue = new ConcurrentQueue<MeasureProduct>();
        //public static ConcurrentQueue<DataItem> measuredata1 = new ConcurrentQueue<DataItem>();
        //public static ConcurrentQueue<DataItem> measuredata2 = new ConcurrentQueue<DataItem>();

        public static ConcurrentDictionary<int, List<DataItem>> measuredata1 = new ConcurrentDictionary<int, List<DataItem>>();
        public static ConcurrentDictionary<int, List<DataItem>> measuredata2 = new ConcurrentDictionary<int, List<DataItem>>();

        //public static List<Task> tasks = new List<Task>();

        public static int OKCount = 0;
        public static int NGCount = 0;
        public static int NACount = 0;
        public static int ExceptionCount = 0;
        public static int TotalCount = 0;
        public static Task dataThread;

        public static bool Sample_4 = false;//上传macmini，手动标记


        public static bool isAppleUploadFinish = true;
        public static bool isUploadAppleNg = false;

        //Program是否在运行
        public static Stopwatch CT = new Stopwatch();
        public static string ProjectName = "";
        public static string startDate = DateTime.Now.ToString("yyyy-MM-dd");
        public static string startTime = DateTime.Now.ToString("HH:mm:ss");

        public static int clearMachineCount = 0;//清料次数

        //窗体显示情况
        public static bool isSettingFormShow = false;
        public static bool isHomeFormShow = false;
        public static bool isLoginFormshow = false;
        public static bool isParamsSettingDialogShow = false;
        public static bool isStatisticsFromShow = false;
        public static bool isVisionFromshow = false;
        public static bool isAlarmFromshow = false;
        //login
        public static string username = "";
        public static string password = "";

        //MES上传
        public static MURMES MURMES { get; set; }
        public static string MES_MdlCode { get; set; }

        //block
        public static bool isRunBlock = false;
        public static bool isBlockModel = false;
        public volatile static bool isClearMachine = false;


        //点检
        public static bool isAutoCompensation = false;//是否自动补偿
        public static string pointCheckPath = Environment.CurrentDirectory + "\\Config\\Config";
        public static bool isPointCheck = false;//Block点检标志
        public static bool isGRRPointCheck = false;//GRR点检标志
        public static bool isLinearPointCheck = false;//线性点检标志 默认开启 真实测block数据关闭

        public static int ProductType = -1;//-1正常产品    大中小   3  2  1
        public static int ProductTypeRight = -1;//-1正常产品    大中小   3  2  1


        public static string GRRPointCheckSize = "";//GRR点检尺寸
        public static DataTable pointCheckTable = null;//Block点检表
        public static DataTable GRRPointCheckTable = null;//GRR点检表
        public static DataTable GRRRangeTable = null;//GRR范围表
        public static DataTable BlockNomalTable = null;//Block标准值


        //算子所在路径
        public static string ProcedurePath = "";

        public static string values;
        public static string KBvalues;

        //swd上传Mes
        public static string MesJession = "";
        public static string MesTestId = "";
        public static string MesUrl = "";
        public static bool isUploadMes = false;
        public static bool isUploadApple = false;
        public static string MesDcGroup = "";
        public static bool UploadMESFail = false; //上传MES失败
        public static string siteId = "";
        //swd MPMS上传,控制信息，采集信息，参数信息
        public static Dictionary<string, string> controlDic = new Dictionary<string, string>();
        public static Dictionary<string, string> colectItemDic = new Dictionary<string, string>();
        public static Dictionary<string, string> pramsDic = new Dictionary<string, string>();
        public static string smaple = string.Empty;

        //抽检采样
        public static Random r_Sample = new Random();//抽样
        public static List<string> SampleSN = new List<string>();//是否是抽样产品
        public static bool isSample = false;//是否开启采样
        public static int sampleCount = 0;//总样总数
        public static int samplePersent = 0;//抽样概率
        public static int curSampleCount = 0;//已经抽样个数
        public static int curMeasureId = 0;//总样本数
        public static List<int> sampleIndexList = new List<int>();

        //NG上传过滤
        public static int NgCount = 0;//NG个数
        public static int NgUpLimit = 5;//NG个数上限，一个过滤轮回
        public static int NgSelectCount = 0;//一个过滤轮回需要过滤的NG总个数
        public static int NgSelectedCount = 0;//一个过滤轮回需要过滤内，已经过滤的NG个数
        public static List<string> NgNameList = new List<string>();//需要监控的NG尺寸
        public static bool isSelectedNGCell = false;//是否选出所需过滤出来的电芯
        public static bool isCurNGCellSelected = false;//当前CELL是否是选出的所需过滤的电芯

        public static string leftResult = "";
        public static string rightResult = "";

        public static BZLogger AppendUiLog;

        public static TimeSpan CtLook;//总CT
        public static TimeSpan CtLook0;
        public static TimeSpan CtLook1;
        public static TimeSpan CtLook2;
        public static TimeSpan CtLook3;
        public static TimeSpan CtLook4;
        public static TimeSpan CtLook5;
        public static TimeSpan CtLook6;
        public static TimeSpan CtLook7;
        public static TimeSpan CtLook8;
        public static TimeSpan CtLook9;
        public static TimeSpan CtLook10;
        public static TimeSpan CtLook11;
        public static TimeSpan CtLook12;

        public static Stopwatch sw = new Stopwatch();
        public static Stopwatch sw0 = new Stopwatch();
        public static Stopwatch sw1 = new Stopwatch();
        public static Stopwatch sw2 = new Stopwatch();
        public static Stopwatch sw3 = new Stopwatch();
        public static Stopwatch sw4 = new Stopwatch();
        public static Stopwatch sw5 = new Stopwatch();
        public static Stopwatch sw6 = new Stopwatch();
        public static Stopwatch sw7 = new Stopwatch();
        public static Stopwatch sw8 = new Stopwatch();
        public static Stopwatch sw9 = new Stopwatch();
        public static Stopwatch sw10 = new Stopwatch();
        public static Stopwatch sw11 = new Stopwatch();
        public static Stopwatch sw12 = new Stopwatch();

        public static bool IsSaveImage = false;

        public static bool isShiledBeforStation = false;

        public static bool isShiledSafeDoor = true;
        public static bool isShiledSafeScreen = true;
        //是否自动上料
        public static bool isAutoLoading = true;

        //强制ok
        public static bool isForceOK = false;
        public static bool isForceNG = false;
        public static bool isForceORT = false;
        public static bool isNA = false;

        public static bool isAutoLoadPuting = false;//自动上料工站正在放料


        public volatile static List<Axis> CurentStationAxes = new List<Axis>();//当前工站对应的轴


        public static string RedisUrl = "192.168.10.3:6379";

        public static string PathLog = Application.StartupPath + @"\DalsaCam\";
        public static string PathConfig = @"D:\Data\Config\BZ-Parameter\PFA\";
        public static PrjPara pPrjPara;

        public static Stopwatch s11 = new Stopwatch();

        #region Quebec
        public enum LineName
        {
            ATL, MUR
        }
        public delegate void delegateUpdateStartOnce (bool? 启动一次, string msg = "");
        public static int 气缸等待时间 = 3000;
        public static bool 是否联机上料PLC = false;
        public static bool 是否联机下料PLC = false;
        public static bool 屏蔽扫码 = false;
        public static bool 手动启动 = false;
        public static bool 启动一次 = false;
        public static bool 点检启动一次 = false;
        public static int CurGRR循环次数 = 0;
        public static int GRR循环次数 = 9;
        public static int PPG保压时间 = 9;
        public static bool 启用PPG = false;
        public static int BarcodeLength = 0;
        public static bool isWriteLog = false;
        public static bool 是否检测信号 = false;
        public static bool GRR循环模式 = false;
        public static bool 是否带料 = false;

        private static bool _屏蔽治具1;

        public static bool 屏蔽治具1
        {
            get { return _屏蔽治具1; }
            set { _屏蔽治具1 = value; Machine.OmronPLC.Write("stPC_PLC.Spare_BOOL[0]", value); }
        }

        private static bool _屏蔽治具2;

        public static bool 屏蔽治具2
        {
            get { return _屏蔽治具2; }
            set { _屏蔽治具2 = value; Machine.OmronPLC.Write("stPC_PLC.Spare_BOOL[1]", value); }
        }

        public volatile static bool 启用算法补偿 = false;
        public static string 算法补偿范围下限 = "";
        public static string 算法补偿范围上限 = "";

        public static string 左侧工控机IP = "192.168.50.1";
        public static double PPGOffset1 = 0;
        public static double PPGOffset2 = 0;

        public static string PPG_Name = "";

        public static int whichBlock = -1;

        public static bool pointCheck = false;

        public static bool 治具1点检 = false;
        public static bool 治具2点检 = false;

        public static int Count_CarrierA = 0;
        public static int Command_CarrierA = 0;
        public static int Count_CarrierB = 0;
        public static int Command_CarrierB = 0;

        public static MeasureProduct Data_A_Load = new MeasureProduct();
        public static MeasureProduct Data_A_Measure1 = new MeasureProduct();

        public static MeasureProduct Data_B_Load = new MeasureProduct();
        public static MeasureProduct Data_B_Measure1 = new MeasureProduct();
        public static MeasureProduct Data_DownMidLaser = new MeasureProduct();

        public static MeasureProduct Data_UnloadTransMove = new MeasureProduct();
        public static MeasureProduct Data_Unload = new MeasureProduct();
        public static MeasureProduct Data_UnloadRotate = new MeasureProduct();

        public static ECommunacation SocketOtherSide = null;
        public static ECommunacation SocketRightSide = null;

        public static KeyenceScanReader ScanReader1 = new KeyenceScanReader();
        public static KeyenceScanReader ScanReader2 = new KeyenceScanReader();

        public static bool GRREnd = false;
        public static int GRR换穴 = 0; //0：未交叉 1：已交叉 
        public static bool pointCheckEnd = false;
        public static int Cur点检次数 = 0;

        public static MeasureProduct CloneTempData (ref MeasureProduct src, bool isEmptySrc = true)
        {
            MeasureProduct dst = new MeasureProduct()
            {
                SN = src.SN,
                Position = src.Position,
                whichBlock = src.whichBlock,
                NG_FAI = src.NG_FAI,
                MeasureData = src.MeasureData,
                ProductID = src.ProductID,

                SideCam_1 = src.SideCam_1,
                SideCam_2 = src.SideCam_2,

                SideLaser_长边1 = src.SideLaser_长边1,
                SideLaser_长边2 = src.SideLaser_长边2,
                UpLaser = src.UpLaser,

                SideLaser_短边1 = src.SideLaser_短边1,
                SideLaser_短边2 = src.SideLaser_短边2,

                UpCamImage_1 = src.UpCamImage_1,
                UpCamImage_2 = src.UpCamImage_2,
                UpCamImage_3 = src.UpCamImage_3,
                UpCamImage_4 = src.UpCamImage_4,

                DownLaser1 = src.DownLaser1,
                Result = src.Result,
            };
            if(isEmptySrc)
                src = null;
            return dst;
        }

        public volatile static ConcurrentQueue<ReturnResultProtocol> resultDataQueue = new ConcurrentQueue<ReturnResultProtocol>();
        public static ReturnResultProtocol returnResultProtocol = new ReturnResultProtocol();


        public volatile static ConcurrentQueue<string> BarcodeQueue = new ConcurrentQueue<string>();

        public static ConcurrentQueue<MeasureProduct> SaveImages = new ConcurrentQueue<MeasureProduct>();

        public static bool bTotalResult = false; //最终Vision+PPG的结果

        public static bool b_左侧请求放NG = false;

        public static bool b_左侧已经打开NG信号 = false;

        public static bool b_左侧已经关闭NG信号 = false;


        public static bool b_右侧要求打开NG信号 = false;
        public static bool b_右侧要求关闭NG信号 = false;



        public static bool b_左侧请求放ORT = false;

        public static bool b_左侧已经打开ORT信号 = false;

        public static bool b_左侧已经关闭ORT信号 = false;


        public static bool b_右侧要求打开ORT信号 = false;
        public static bool b_右侧要求关闭ORT信号 = false;

        #region 上传苹果MacMini连接服务器定义变量
        public static AsyncTcpIpUtils.ClientAsync AsyncClient_MacMini = new AsyncTcpIpUtils.ClientAsync();  //连接自身通讯软件
        public static string AsyncRcvMsgFromMacMini;  //接收到的信息
        public static string strKey_MacMini;

        public static JUDGEMENT_RESULT rtnDataResult_Vision = JUDGEMENT_RESULT.OK; //视觉算法数据判定结果
        public static JUDGEMENT_RESULT rtnDataResult_PPG = JUDGEMENT_RESULT.OK; //PPG数据判定结果

        public static bool b硬件初始化成功 = false;



        public static SRController sRController1;
        public static SRController sRController2;
        public static SRController sRController3;

        public static List<CameraModel> CameraParams = new List<CameraModel>();
        public static MVControllerStrategy MVCameraList = new MVControllerStrategy();
        #endregion
        #endregion


        public static Action<List<ProductTypeMeasureItemEnable>> UpdateMeasureItemsEnable = null;
        public static string ProTypeIniPath = Application.StartupPath + @"\Config\ProductType.ini";
        public static string ProTypeCsvPath = Application.StartupPath + @"\Config\ProductType.csv";
        public static string CurProType = "Product";
        public const string Section_ProductTypeConfig = "ProductTypeConfig";
        public const string Section_MeasureItems = "MeasureItems";
        public static List<string> DefaultMeasureItems = new List<string>();
        public static List<ProductTypeMeasureItemEnable> ProductTypeMeasureItemEnableList = new List<ProductTypeMeasureItemEnable>();
        public static ProductTypeMeasureItemEnable CurProTypeMeasureItems = new ProductTypeMeasureItemEnable();


        //深视激光
        public static SRController UpLaser1 = new SRController(); //上激光1
        public static SRController DownLaser1 = new SRController(); //上激光2
        public static SRController DownLaser2 = new SRController(); //下激光

        public static string SideLaser1_SN = "";
        public static string SideLaser2_SN = "";
        public static string UpLaser_SN = "";
        public static string DownLaser_SN = "";


        public volatile static bool isPLCInitialed_上料机 = false;
        public volatile static bool isPLCInitialed_下料机 = false;

        public static string plcIP_上料机 = "";
        public static string plcIP_下料机 = "";

        public static string plcPort_上料机 = "";
        public static string plcPort_下料机 = "";
        public static string ppgIP = "";
        public static string PPGIP2 = "";

        public static string 偏移量X = "";
        public static string 偏移量Y = "";
        public static string 偏移量Theta = "";


        public static int 光源打开延时 = 100;
        public static bool 屏蔽相机采图 = false;
        public static bool 屏蔽激光扫描 = false;

        public static bool 屏蔽左线 = false;
        public static bool 屏蔽右线 = false;

        public static bool 屏蔽算法 = false;

        public static bool b_左侧收到双动子允许接料信号 = false;
        public static bool b_双动子收到左侧取料完成信号 = false;

        public static bool b_双动子允许关闭真空信号 = false;
        public static bool b_双动子收到左侧关闭真空完成 = false;

        public static string Result_左侧 = string.Empty;






        public static bool b_上料PLC请求放左侧 = false;
        public static bool b_左侧允许PLC放料 = false;

        public static bool b_上料PLC左侧运动到位 = false;
        public static bool b_左侧允许PLC离开 = false;

        public static bool b_上料PLC左侧已离开 = false;
        public static bool b_左侧收到PLC已离开 = false;

        public static string str_左侧二维码 = string.Empty;

        #region PLC 交互信号地址
        public static string strAddress_ToFeedPLC_HeartBeat = "MR1000";
        public static string strAddress_ToFeedPLC_DevicePause = "MR1001";
        public static string strAddress_ToFeedPLC_Abnormal = "MR1002";
        public static string strAddress_ToFeedPLC_DeviceSafety = "MR1003";
        public static string strAddress_ToFeedPLC_ASideGRR = "MR1004";
        public static string strAddress_ToFeedPLC_ASideShielded = "MR1005";
        public static string strAddress_ToFeedPLC_ASideAllowPut = "MR1006";
        public static string strAddress_ToFeedPLC_ASideAllowLeave = "MR1007";
        public static string strAddress_ToFeedPLC_BSideGRR = "MR1008";
        public static string strAddress_ToFeedPLC_BSideShielded = "MR1009";
        public static string strAddress_ToFeedPLC_BSideAllowPut = "MR1010";
        public static string strAddress_ToFeedPLC_BSideAllowLeave = "MR1011";

        public static string strAddress_FromFeedPLC_HeartBeat = "MR2000";
        public static string strAddress_FromFeedPLC_DevicePause = "MR2001";
        public static string strAddress_FromFeedPLC_Abnormal = "MR2002";
        public static string strAddress_FromFeedPLC_DeviceSafety = "MR2003";
        public static string strAddress_FromFeedPLC_ASideExistProduct = "MR2004";
        public static string strAddress_FromFeedPLC_BSideExistProduct = "MR2005";
        public static string strAddress_FromFeedPLC_ASideRequirePut = "MR2006";
        public static string strAddress_FromFeedPLC_ASidePutInpos = "MR2007";
        public static string strAddress_FromFeedPLC_BSideRequirePut = "MR2008";
        public static string strAddress_FromFeedPLC_BSidePutInpos = "MR2009";
        public static string strAddress_FromFeedPLC_ASidePutFinish = "MR2010";
        public static string strAddress_FromFeedPLC_BSidePutFinish = "MR2011";




        public static string strAddress_ToUnloaderPLC_HeartBeat = "MR1000";
        public static string strAddress_ToUnloaderPLC_DevicePause = "MR1001";
        public static string strAddress_ToUnloaderPLC_Abnormal = "MR1002";
        public static string strAddress_ToUnloaderPLC_DeviceSafety = "MR1003";
        public static string strAddress_ToUnloaderPLC_ASideGRR = "MR1004";
        public static string strAddress_ToUnloaderPLC_ASideShielded = "MR1005";
        public static string strAddress_ToUnloaderPLC_ASideAllowPick = "MR1006";
        public static string strAddress_ToUnloaderPLC_ASideAllowLeave = "MR1007";
        public static string strAddress_ToUnloaderPLC_BSideGRR = "MR1008";
        public static string strAddress_ToUnloaderPLC_BSideShielded = "MR1009";
        public static string strAddress_ToUnloaderPLC_BSideAllowPick = "MR1010";
        public static string strAddress_ToUnloaderPLC_BSideAllowLeave = "MR1011";
        public static string strAddress_ToUnloaderPLC_ASideExistProduct = "MR1012";
        public static string strAddress_ToUnloaderPLC_BSideExistProduct = "MR1013";
        public static string strAddress_ToUnloaderPLC_NGBelt1AllowPut = "MR1014";
        public static string strAddress_ToUnloaderPLC_NGBelt2AllowPut = "MR1015";
        public static string strAddress_ToUnloaderPLC_CheckBeltAllowPut = "MR1100";
        public static string strAddress_ToUnloaderPLC_ASideResult = "MR1105";
        public static string strAddress_ToUnloaderPLC_BSideResult = "MR1106";

        public static string strAddress_FromUnloaderPLC_HeartBeat = "MR2000";
        public static string strAddress_FromUnloaderPLC_DevicePause = "MR2001";
        public static string strAddress_FromUnloaderPLC_Abnormal = "MR2002";
        public static string strAddress_FromUnloaderPLC_DeviceSafety = "MR2003";
        public static string strAddress_FromUnloaderPLC_ASidePickInpos = "MR2004";
        public static string strAddress_FromUnloaderPLC_ASidePickFinish = "MR2005";
        public static string strAddress_FromUnloaderPLC_BSidePickInpos = "MR2006";
        public static string strAddress_FromUnloaderPLC_BSidePickFinish = "MR2007";
        public static string strAddress_FromUnloaderPLC_ASidePutNGBelt1Finish = "MR2008";
        public static string strAddress_FromUnloaderPLC_ASidePutNGBelt2Finish = "MR2009";
        public static string strAddress_FromUnloaderPLC_ASidePutCheckBeltFinish = "MR2010";

        public static string strAddress_FromFeedPLC_RequreCapture1 = "MR5000";
        public static string strAddress_FromFeedPLC_RequreCapture2 = "MR5001";
        public static string strAddress_ToFeedPLC_Capture1Finish = "MR5500";
        public static string strAddress_ToFeedPLC_Capture2Finish = "MR5501";

        public static string strAddress_ToFeedPLC_Capture1_X = "EM200";
        public static string strAddress_ToFeedPLC_Capture1_Y = "EM201";
        public static string strAddress_ToFeedPLC_Capture1_Theta = "EM202";

        public static string strAddress_ToFeedPLC_Capture2_X = "EM210";
        public static string strAddress_ToFeedPLC_Capture2_Y = "EM211";
        public static string strAddress_ToFeedPLC_Capture2_Theta = "EM212";

        public static string strAddress_FromFeedPLC_ASideBarcode = "EM300";
        public static string strAddress_FromFeedPLC_BSideBarcode = "EM400";
        #endregion


        #region 各个工位数据传输
        //public static MeasureProduct Data_侧激光_CarrierA = new MeasureProduct(); //CarrierA
        //public static MeasureProduct Data_侧激光_CarrierB = new MeasureProduct(); //CarrierA

        //public static MeasureProduct Data_Loading_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_Loading_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_LoadingPanel1_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_LoadingPanel1_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_PPG_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_PPG_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_LoadingPanel2_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_LoadingPanel2_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_FlipPut_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_FlipPut_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_FlipCatch_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_FlipCatch_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_Transform_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_Transform_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_Measure_Fixture1 = new MeasureProduct();
        //public static MeasureProduct Data_Measure_Fixture2 = new MeasureProduct();

        //public static MeasureProduct Data_UnloadingRotate1 = new MeasureProduct();
        //public static MeasureProduct Data_UnloadingRotate2 = new MeasureProduct();
        #endregion


        public static LJX8Laser SideLaser1 = null;// new LJX8Laser(0 , "192.168.3.10" , 24691 , 24692 );
        public static LJX8Laser SideLaser2 = null;//new LJX8Laser(1, "192.168.4.10", 24691, 24692);
        public static LJX8Laser UpLaser = null;//new LJX8Laser(2, "192.168.5.10", 24691, 24692);
        public static LJX8Laser DownLaser = null;//new LJX8Laser(2, "192.168.5.10", 24691, 24692);

        public static Dictionary<string, bool> dic_plcComm_Bool = new Dictionary<string, bool>();
        public static Dictionary<string, int> dic_plcComm_Int = new Dictionary<string, int>();
    }


    public class ProductTypeMeasureItemEnable
    {
        public string ProductType { get; set; }


        public Dictionary<string, bool> MeasureItemEnableDic { get; set; }

        public ProductTypeMeasureItemEnable ()
        {
            ProductType = "";
            MeasureItemEnableDic = new Dictionary<string, bool>();
        }
    }

    public class GUIEventArgs : EventArgs
    {
        public int Index
        {
            get; set;
        }

        public GUIEventArgs (int msg)
        {
            Index = msg;
        }
    }

}
